import React, { useState, useEffect } from 'react';
import Login from './components/Login';
import Main from './components/Main';
import { AuthProvider, useAuth } from './contexts/AuthContext';

function App() {

  const AppContent: React.FC = () => {
    const { isLogin, isLoading } = useAuth();

    if (isLoading) {
      return <div>加载中...</div>;
    }

    return isLogin ? <Main /> : <Login />;
  };

  return (
    <AuthProvider>
      <AppContent />
    </AuthProvider>
  );
}

export default App;